package station;

public class Bus extends Vehicle{
    private int passengers;

    public Bus() {
    }

    public Bus(int length, String plateNo, int passengers) {
        super(length, plateNo);
        this.passengers = passengers;
    }

    public int getPassengers() {
        return passengers;
    }

    public void setPassengers(int passengers) {
        this.passengers = passengers;
    }

    @Override
    public void print() {
        super.print();
        System.out.println("核定载人数："+this.getPassengers());
    }

    @Override
    public double getRate() {
        double rate = 0;
        int length = super.getLength();
        int passengers = this.getPassengers();
        if (length<6000 && passengers<=9){
            rate = 0.6;
        }else if(length<6000 && (passengers>=10 && passengers<=19)){
            rate = 0.6;
        }else if(length>=6000 && passengers<=39){
            rate = 0.9;
        }else if(length>=6000 && passengers>=40){
            rate = 0.9;
        }
        return rate;
    }
}
